package me.xue.communityhealth.repo;

import org.apache.ibatis.annotations.*;
import org.springframework.stereotype.Repository;

import java.util.List;

@Repository
@Mapper
public interface DepartmentRepository {

    @Insert("INSERT INTO `department` VALUES(#{departmentName});")
    int save(String departmentName);

    @Delete("DELETE FROM `department` WHERE `name`=#{departmentName}")
    int delete(String departmentName);

    @Update("UPDATE `department` SET name=#{new} WHERE name=#{old}")
    int update(@Param("old") String oldDepartment, @Param("new") String newDepartment);

    @Select("SELECT * FROM `department`")
    List<String> findAll();

}
